
import os
import shutil
import sys
import time
import math
import json
import zipfile
from subprocess import run
import subprocess
# import thread
# import thread6
sys.path.append('../..')
import FileUtils
import ArrayUtils

curPath = os.getcwd()
print(curPath)

projectPath = os.path.abspath(os.path.join(os.path.dirname(curPath), os.pardir,os.pardir))
print(projectPath)

import platform
sysstr = platform.system()
print(platform)


#arg[1]:渠道名:proj.ios_mac_appstore
if __name__ == "__main__":
	#复制sdk
	FileUtils.copyDirOneByOne(os.path.join(curPath,"resource/utils"),os.path.join(projectPath,"build/wechatgame/utils"))
	#修改game.js

	code = FileUtils.readUtf8FileData(os.path.join(curPath,"resource/code.js"))
	gameCode = FileUtils.readUtf8FileData(os.path.join(projectPath,"build/wechatgame/game.js"))
	pos = gameCode.find("\n")
	begin = gameCode[0:pos]
	end = gameCode[pos+1:]
	finalStr = begin +"\n"+ code +"\n"+ end
	FileUtils.writeToUtf8File(os.path.join(projectPath,"build/wechatgame/game.js"),finalStr)
	pass



